import 'package:dio/dio.dart';

class CustomInterceptor extends Interceptor {
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    // 在请求发送前进行处理
    print('请求拦截: ${options.path}');
    handler.next(options);
  }

  @override
  void onResponse(Response response, ResponseInterceptorHandler handler) {
    // 在响应返回后进行处理
    print('响应拦截: ${response.statusCode}');
    handler.next(response);
  }

  @override
  void onError(DioError err, ErrorInterceptorHandler handler) {
    // 在请求出错时进行处理
    print('错误拦截: ${err.message}');
    handler.next(err);
  }
}
